home *** CD-ROM | disk | FTP | other *** search
/ TOS Silver 2000 / TOS Silver 2000.iso / programm / GNU_C++ / LIB / MTLB49CF.LZH / include / sys / termios.h < prev    next >
Encoding:
C/C++ Source or Header  |  1998-05-29  |  4.2 KB  |  212 lines

  1. #ifndef _TERMIOS_H
  2. #define _TERMIOS_H
  3.  
  4. #ifndef _COMPILER_H
  5. #include <compiler.h>
  6. #endif
  7.  
  8. #define VEOF    0
  9. #define VEOL    1
  10. #define VERASE    2
  11. #define VINTR    3
  12. #define VKILL    4
  13. #define VQUIT    5
  14. #define VSUSP    6
  15. #define VSTART    7
  16. #define VSTOP    8
  17. #define VMIN    9
  18. #define VTIME    10
  19. #define VLNEXT    11        /* <-- Not POSIX */
  20. #define VWERASE    12        /* <-- Not POSIX */
  21. #define VDSUSP    13        /* <-- Not POSIX */
  22. #define VREPRINT 14        /* <-- Not POSIX */
  23. #define VFLUSHO    15        /* <-- Not POSIX */
  24.  
  25. #define NCCS    (VFLUSHO + 1)
  26.  
  27. /* Canonical values for control characters. */
  28. #ifndef _POSIX_VDISABLE
  29. #define _POSIX_VDISABLE ((unsigned char) 0)
  30. #endif
  31.  
  32. #ifndef CEOF
  33. #define    CEOF    ('d' & 0x1f)
  34. #endif
  35. #ifndef CEOL
  36. #define    CEOL    ('m' & 0x1f)
  37. #endif
  38. #ifndef CERASE
  39. #define    CERASE    ('h' & 0x1f)
  40. #endif
  41. #ifndef CINTR
  42. #define    CINTR    ('c' & 0x1f)
  43. #endif
  44. #ifndef CKILL
  45. #define    CKILL    ('u' & 0x1f)
  46. #endif
  47. #ifndef CQUIT
  48. #define    CQUIT    28
  49. #endif
  50. #ifndef CSUSP
  51. #define    CSUSP    ('z' & 0x1f)
  52. #endif
  53. #ifndef CSTART
  54. #define    CSTART    ('q' & 0x1f)
  55. #endif
  56. #ifndef CSTOP
  57. #define    CSTOP    ('s' & 0x1f)
  58. #endif
  59. #ifndef CLNEXT
  60. #define    CLNEXT    ('v' & 0x1f)
  61. #endif
  62. #ifndef CWERASE
  63. #define    CWERASE    ('w' & 0x1f)
  64. #endif
  65. #ifndef CDSUSP
  66. #define    CDSUSP    ('y' & 0x1f)
  67. #endif
  68. #ifndef CRPRNT
  69. #define    CRPRNT    ('r' & 0x1f)
  70. #endif
  71. #ifndef CFLUSHO
  72. #define CFLUSHO    ('o' & 0x1f)
  73. #endif
  74.  
  75. typedef unsigned short tcflag_t;
  76. typedef unsigned short speed_t;
  77. typedef unsigned char cc_t;
  78.  
  79. struct termios {
  80.   tcflag_t c_iflag;
  81.   tcflag_t c_oflag;
  82.   tcflag_t c_cflag;
  83.   tcflag_t c_lflag;
  84.   speed_t  _c_ispeed;
  85.   speed_t  _c_ospeed;
  86.   cc_t     c_cc[NCCS];
  87. };
  88.  
  89. /* input flags */
  90. #define BRKINT    0x0001
  91. #define IGNBRK    0x0002
  92. #define IGNPAR    0x0004
  93. #define PARMRK    0x0008
  94. #define INPCK    0x0010
  95. #define ISTRIP    0x0020
  96. #define INLCR    0x0040
  97. #define IGNCR    0x0080
  98. #define ICRNL    0x0100
  99. #define IXON    0x0200
  100. #define IXOFF    0x0400
  101. #define IXANY   0x0800
  102.  
  103. /* output modes */
  104. #define OPOST    0x0001
  105.  
  106. /* control modes */
  107. #define CLOCAL    0x0001
  108. #define CREAD    0x0002
  109. /* next four must agree with _TF_?BIT */
  110. #define CS5    0x000C
  111. #define CS6    0x0008
  112. #define CS7    0x0004
  113. #define CS8    0x0000
  114. # define CSIZE    0x000C
  115. #define CSTOPB    0x0040
  116. #define HUPCL    0x0080
  117. #define PARENB    0x0100
  118. #define PARODD    0x0200
  119. #define CRTSCTS    0x2000        /* <-- Not POSIX(?) */
  120.  
  121. /* local modes */
  122. #define ECHOE    0x0001
  123. #define ECHOK    0x0002
  124. #ifndef _IOCTL_H
  125. #define ECHO    0x0004
  126. #endif /* _IOCTL_H */
  127. #define ECHONL    0x0008
  128. #define ICANON    0x0010
  129. #define ISIG    0x0020
  130. #ifndef _IOCTL_H
  131. #define NOFLSH    0x0040
  132. #endif /* _IOCTL_H */
  133. #define IEXTEN    0x0080
  134. #ifndef _IOCTL_H
  135. #define TOSTOP    0x0100
  136. #define ECHOCTL    0x0400
  137. #endif /* _IOCTL_H */
  138.  
  139. /* actions for tcflow() */
  140. #define TCOOFF        0
  141. #define TCOON        1
  142. #define TCIOFF        2
  143. #define TCION        3
  144.  
  145. /* actions for tcflush() */
  146. #define TCIFLUSH    0
  147. #define TCOFLUSH    1
  148. #define TCIOFLUSH    3
  149.  
  150. /* actions for tcsetattr() */
  151. #define TCSANOW        0
  152. #define TCSADRAIN    1
  153. #define TCSAFLUSH    2
  154.  
  155. /* internal use only */
  156. #define _TF_STOPBITS    0x0003
  157. #define _TF_1STOP    0x0001
  158. #define _TF_15STOP    0x0002
  159. #define    _TF_2STOP    0x0003
  160. #define _TF_CHARBITS    0x000C
  161. #define _TF_8BIT    0
  162. #define _TF_7BIT    0x4
  163. #define _TF_6BIT    0x8
  164. #define _TF_5BIT    0xC
  165. #define _TF_CAR        0x800
  166. #define _TF_BRKINT    0x80
  167.  
  168. #define _TS_BLIND    0x800
  169. #define _TS_HOLD    0x1000
  170. #define _TS_HPCL    0x4000
  171. #define _TS_COOKED    0x8000
  172.  
  173. /* baud rate codes */
  174. #ifndef _IOCTL_H
  175. #define B0        0
  176. #define B50        1
  177. #define B75        2
  178. #define B110        3
  179. #define B134        4
  180. #define B135        4
  181. #define B150        5
  182. #define B200        6
  183. #define B300        7
  184. #define B600        8
  185. #define B1200        9
  186. #define B1800        10
  187. #define B2400        11
  188. #define B4800        12
  189. #define B9600        13
  190. #define B19200        14
  191. #define B38400        15
  192. #define B57600          16
  193. #define B115200         17
  194. #define B230400         18
  195. #endif /* _IOCTL_H */
  196.  
  197. __EXTERN speed_t cfgetispeed    __PROTO((const struct termios *stp));
  198. __EXTERN speed_t cfgetospeed    __PROTO((const struct termios *stp));
  199. __EXTERN int    cfsetispeed    __PROTO((struct termios *stp,
  200.                         speed_t baudcode));
  201. __EXTERN int    cfsetospeed    __PROTO((struct termios *stp,
  202.                         speed_t baudcode));
  203. __EXTERN int    tcdrain        __PROTO((int fd));
  204. __EXTERN int    tcflow        __PROTO((int fd, int action));
  205. __EXTERN int    tcflush        __PROTO((int fd, int action));
  206. __EXTERN int    tcgetattr    __PROTO((int fd, struct termios *stp));
  207. __EXTERN int    tcsendbreak    __PROTO((int fd, int duration));
  208. __EXTERN int    tcsetattr    __PROTO((int fd, int action, 
  209.                         const struct termios *stp));
  210.  
  211. #endif /* _TERMIOS_H */
  212.